package com.zzyl.controller;


import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.NursingPlanDto;
import com.zzyl.service.NursingPlanService;
import com.zzyl.vo.NursingPlanVo;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/nursing/plan")
@Api(tags = "护理计划管理")
public class NursingPlanController {

    @Autowired
    private NursingPlanService nursingPlanService;

    //分页查询
    @GetMapping("/search")
    @ApiOperation(value = "分页查询护理计划")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "planNo", value = "护理计划编号", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "elderName", value = "老人姓名", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态", required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间", required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间", required = false, dataType = "long", paramType = "query")
    })
    public ResponseResult<PageResponse<NursingPlanVo>> selectByPage(Integer pageNum,
                                                                  Integer pageSize,
                                                                  String planNo,
                                                                  String elderName,
                                                                  Integer status,
                                                                  Long startTime,
                                                                  Long endTime) {
        PageResponse<NursingPlanVo> nursingPlanVoPageResponse = nursingPlanService.selectByPage(pageNum, pageSize, planNo, elderName, status, startTime, endTime);
        return ResponseResult.success(nursingPlanVoPageResponse);
    }
    //新增护理计划
    @PostMapping
    @ApiOperation(value = "新增护理计划")
    public ResponseResult addNursingPlan(@RequestBody NursingPlanDto nursingPlanDto){
        nursingPlanService.addNursingPlan(nursingPlanDto);
        return ResponseResult.success();
    }
    //查询所有护理计划
}
